var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/functionalComponent/antd/tab.tsx
var tab_exports = {};
__export(tab_exports, {
  Tabs: () => Tabs
});
module.exports = __toCommonJS(tab_exports);
var import_antd = require("antd");
var import_react = __toESM(require("react"));
var import_util = require("../../util");
var TabsComp = (0, import_util.compHoc)(
  class extends import_util.IUPComponent {
    constructor() {
      super(...arguments);
      this.setActiveKey = (key) => {
        const lastKey = this.state.activeKey;
        const innerChange = async () => {
          var _a, _b;
          const ret = await ((_b = (_a = this.props).onChange) == null ? void 0 : _b.call(_a, key));
          if (ret !== false) {
            this.innerNotify([key], "onChange").then();
            import_util.iup.getPageObserver().notify(
              {
                key,
                containerId: this.getId(),
                instance: this,
                args: [key, lastKey]
              },
              "onActiveKeyChange"
            );
            return true;
          }
          return false;
        };
        if (key !== this.state.activeKey) {
          if (this.props.onChange && this.props.hasOwnProperty("activeKey")) {
            innerChange().then((r) => {
              if (r) {
                this.state.activeKey = key;
              }
            });
          } else {
            this.setState({ activeKey: key }, () => {
              innerChange();
            });
          }
        }
      };
    }
    static getDerivedStateFromProps(nextProps, prevState) {
      return import_util.IUPComponent.propsToState(nextProps, prevState, ["defaultActiveKey|activeKey", "activeKey"]);
    }
    getActiveKey() {
      return this.state.activeKey;
    }
    render() {
      const {
        onChange,
        fitHeight = true,
        overflowVisible = false,
        className,
        children,
        tabBarStyle,
        style,
        observer,
        ...props
      } = this.props;
      if (children && !props.items) {
        props.items = [];
        import_react.default.Children.forEach(children, (item) => {
          if (item) {
            const { children: children2, tab: label, ...others } = item.props;
            props.items.push({ key: item.key, label, children: children2, ...others });
          }
        });
      }
      const newStyle = fitHeight ? { ...style, height: "100%" } : style;
      return /* @__PURE__ */ import_react.default.createElement(
        import_antd.Tabs,
        {
          className: import_util.iup.classNames(className, { "fit-height": fitHeight, "overflow-visible": overflowVisible }),
          tabBarStyle: { ...tabBarStyle },
          style: newStyle,
          ...props,
          activeKey: this.state.activeKey,
          onChange: this.setActiveKey
        }
      );
    }
  },
  "Tabs"
);
var Tabs = TabsComp;
Tabs.Option = import_antd.Tabs.TabPane;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  Tabs
});
